package com.qf.mrmd.controller;

import com.qf.mrmd.entity.Subject;
import com.qf.mrmd.result.ResponseData;
import com.qf.mrmd.service.SubjectService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Subject)表控制层
 *
 * @author makejava
 * @since 2021-07-14 14:39:49
 */
@RestController
@RequestMapping("subject")
public class SubjectController {
    /**
     * 服务对象uuuuuu
     */
    @Autowired
    private SubjectService subjectService;


    @ApiOperation(value = "获取推荐美容项目数据",notes = "通过标题获取美容项目列表")
    @ApiImplicitParam(name="title",value = "美容项目类型",dataType = "string")
    @GetMapping("/{title}")
    public ResponseData subjectInfo(@PathVariable String title){
        ResponseData responseData=subjectService.queryByTitle(title);
        return responseData;
    }

    @ApiOperation(value = "获取美容项目详情",notes = "通过美容项目id获取项目详情")
    @ApiImplicitParam(name = "id",value = "美容项目id",dataType = "integer")
    @GetMapping("/one/{id}")
    public ResponseData subjectDetail(@PathVariable Integer id){
      return subjectService.queryById(id);

    }
}
